package com.ssh.service;

import com.ssh.dao.ProductDao;
import com.ssh.domain.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by H-209-FX-XY on 2018/4/10.
 */
@Service
public class ProductService {
    @Autowired
    private ProductDao productDao;

    @Transactional
    public void save(Product product){
        System.out.println("Service中的save方法执行了....");
        productDao.save(product);
//        int i= 1 /0;
    }

    public List<Product> findAll() {
        return productDao.findAll();
    }
}
